<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <meta name="author" content="Zhang Houjin">
  <link rel="shortcut icon" href="../img/favicon_16.ico">
  
  <title>测试说明 - FIFO_ChatRoom</title>
  <link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>

  <link rel="stylesheet" href="../css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../css/theme_extra.css" type="text/css" />
  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css">
  
  <script>
    // Current page data
    var mkdocs_page_name = "\u6d4b\u8bd5\u8bf4\u660e";
    var mkdocs_page_input_path = "04_Instructions.md";
    var mkdocs_page_url = null;
  </script>
  
  <script src="../js/jquery-2.1.1.min.js" defer></script>
  <script src="../js/modernizr-2.8.3.min.js" defer></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
  <script>hljs.initHighlightingOnLoad();</script> 
  
</head>

<body class="wy-body-for-nav" role="document">

  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
      <div class="wy-side-nav-search">
        <a href=".." class="icon icon-home"> FIFO_ChatRoom</a>
        <div role="search">
  <form id ="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" title="Type search term here" />
  </form>
</div>
      </div>

      <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
	<ul class="current">
	  
          
            <li class="toctree-l1">
		
    <a class="" href="..">主页</a>
	    </li>
          
            <li class="toctree-l1">
		
    <a class="" href="../01_Overview/">项目概述</a>
	    </li>
          
            <li class="toctree-l1">
		
    <a class="" href="../02_KeyPoint/">关键问题</a>
	    </li>
          
            <li class="toctree-l1">
		
    <a class="" href="../03_Analysis/">流程分析</a>
	    </li>
          
            <li class="toctree-l1 current">
		
    <a class="current" href="./">测试说明</a>
    <ul class="subnav">
            
    <li class="toctree-l2"><a href="#_1">操作说明</a></li>
    
        <ul>
        
            <li><a class="toctree-l3" href="#0">0. 克隆工程文件</a></li>
        
            <li><a class="toctree-l3" href="#1">1. 编译程序</a></li>
        
            <li><a class="toctree-l3" href="#2">2. 运行服务器程序</a></li>
        
            <li><a class="toctree-l3" href="#3">3. 运行客户端程序</a></li>
        
            <li><a class="toctree-l3" href="#4">4. 退出程序</a></li>
        
            <li><a class="toctree-l3" href="#5">5. 测试视频</a></li>
        
        </ul>
    

    </ul>
	    </li>
          
            <li class="toctree-l1">
		
    <a class="" href="../05_Log/">项目日志</a>
	    </li>
          
            <li class="toctree-l1">
		
    <a class="" href="../06_SourceCode/">项目源代码</a>
	    </li>
          
        </ul>
      </div>
      &nbsp;
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
        <a href="..">FIFO_ChatRoom</a>
      </nav>

      
      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    <li><a href="..">Docs</a> &raquo;</li>
    
      
    
    <li>测试说明</li>
    <li class="wy-breadcrumbs-aside">
      
        <a href="https://github.com/ZHJ0125/FIFO_ChatRoom/edit/master/docs/04_Instructions.md"> Edit on FIFO_ChatRoom</a>
      
    </li>
  </ul>
  <hr/>
</div>
          <div role="main">
            <div class="section">
              
                <h1 id="_1">操作说明</h1>
<blockquote>
<p>本章节用来描述程序的运行方法</p>
</blockquote>
<h2 id="0">0. 克隆工程文件</h2>
<ul>
<li>为了保证工程文件的完整性，请使用git克隆本工程</li>
</ul>
<pre><code class="bash"># Example
zhj@thinkpad-vmware:~$ git clone https://gitee.com/zhj0125/FIFO_ChatRoom.git
Cloning into 'FIFO_ChatRoom'...
remote: Enumerating objects: 258, done.
remote: Total 258 (delta 0), reused 0 (delta 0), pack-reused 258
Receiving objects: 100% (258/258), 10.87 MiB | 1.23 MiB/s, done.
Resolving deltas: 100% (104/104), done.
zhj@thinkpad-vmware:~$ 
</code></pre>

<h2 id="1">1. 编译程序</h2>
<ul>
<li>进入到<code>/Project</code>目录下</li>
<li>使用<code>make</code>命令，对程序进行编译</li>
<li>编译完成后，会生成客户端程序<code>client</code>和服务端程序<code>server</code></li>
</ul>
<pre><code class="bash"># Example
zhj@thinkpad-vmware:~$ ls
Desktop    Downloads  Music  Public  Pictures   Videos
Templates  Documents  FIFO_ChatRoom  TicketingSystem
# 进入FIFO_ChatRoom工程文件夹
zhj@thinkpad-vmware:~$ cd FIFO_ChatRoom/
zhj@thinkpad-vmware:~/FIFO_ChatRoom$ ls
Data  LICENSE  MkDocs  Project  README.md
zhj@thinkpad-vmware:~/FIFO_ChatRoom$ cd Project/
zhj@thinkpad-vmware:~/FIFO_ChatRoom/Project$ ls
client.c  fifo.c  fifo.h  Makefile  server.c
# 编译
zhj@thinkpad-vmware:~/FIFO_ChatRoom/Project$ make
cc    -c -o client.o client.c
cc    -c -o fifo.o fifo.c
cc    -c -o server.o server.c
rm ./*.o
# 检查生成的文件
zhj@thinkpad-vmware:~/FIFO_ChatRoom/Project$ ls
client  client.c  fifo.c  fifo.h  Makefile  server  server.c
zhj@thinkpad-vmware:~/FIFO_ChatRoom/Project$ 
</code></pre>

<h2 id="2">2. 运行服务器程序</h2>
<ul>
<li>承接上一步</li>
<li>执行<code>./server</code>，以启动服务端程序</li>
<li>等待客户端的信息</li>
</ul>
<pre><code class="bash"># Example
zhj@thinkpad-vmware:~/FIFO_ChatRoom/Project$ ./server 
Server_FIFO has been bulid
■  # 光标在此处闪烁，服务端阻塞
</code></pre>

<h2 id="3">3. 运行客户端程序</h2>
<ul>
<li>承接上一步</li>
<li>打开一个新的终端</li>
<li>在新终端中执行<code>./client</code>，以启动客户端程序</li>
<li>根据提示，输入您的用户名</li>
<li>在终端中直接输入您要发送的信息，信息将会以广播的形式，发给所有在线的客户端</li>
<li>使用<code>to: [Target_Client_Name] [Message_To_Be_Sent]</code>的格式，可以向指定的客户端发送私聊信息</li>
<li>可以开启多个终端，启动多个客户端程序进行测试</li>
</ul>
<pre><code class="bash"># Example
-------------------------------------------------------
# 在新的终端窗口执行以下命令
zhj@thinkpad-vmware:~$ cd FIFO_ChatRoom/Project/
zhj@thinkpad-vmware:~/FIFO_ChatRoom/Project$ ./client 
🎉 欢迎来到FIFO聊天室 🎉
请输入您的用户名: ZHJ0125
Client PID is: 5496
Client Message is: handshake
2021-11-12 14:48:10 👇
👦 [ZHJ0125] 进入聊天室 
hello,this is zhj!       # 用户在此处输入聊天信息
2021-11-12 14:54:39 👇
[ZHJ0125] said: hello,this is zhj!
■ # 客户端阻塞，等待用户输入聊天信息
-------------------------------------------------------
# 在服务端终端窗口显示以下信息
zhj@thinkpad-vmware:~/FIFO_ChatRoom/Project$ ./server 
Server_FIFO has been bulid
Client Pid is : 5496             # 客户端进程号
Client Message is : handshake
This is a new client!
Client_FIFO_5496 has been bulid  # 根据客户端进程号创建管道文件
The 5496 has been recorded
Client Number is : 1
Client Target is: Broadcast
Write message to Client_5496 Success!
# 服务端显示一组广播消息
Client Pid is : 5496             # 源客户端的进程号
Client Message is : hello,this is zhj! # 源客户端消息内容
Client Target is: Broadcast      # 消息类型，此处为广播消息，所有客户端均可接收
Write message to Client_5496 Success!
■ # 光标在此处闪烁，服务端阻塞，等待客户端下次发送消息
-------------------------------------------------------
</code></pre>

<h2 id="4">4. 退出程序</h2>
<ul>
<li>客户端输入 <code>quit</code> 退出聊天室</li>
<li>服务端使用 <code>Ctrl + C</code> 组合键退出程序</li>
</ul>
<pre><code class="bash"># 客户端执行命令
quit      # 输入quit
Client_5496 exit
Removed Client_FIFO_5496
Child process has been stoped
zhj@thinkpad-vmware:~/FIFO_ChatRoom/Project$ 
# 服务端执行退出命令
^C        # 组合键Ctrl+C
Server is exiting...
Removed Server_FIFO
See you again 😉
zhj@thinkpad-vmware:~/FIFO_ChatRoom/Project$ 
</code></pre>

<h2 id="5">5. 测试视频</h2>
<blockquote>
<p>建议您观看该测试视频，以便更好地了解测试方法</p>
</blockquote>
<ul>
<li>点击观看 <a href="https://www.bilibili.com/video/BV1254y197AU/">BiliBili - Linux_命名管道_聊天室_V2.0版本_测试视频</a></li>
</ul>
<p><a href="https://www.bilibili.com/video/BV1254y197AU/"><img alt="测试视频" src="../img/Video_Show_V2.png" /></a></p>
<hr />
<blockquote>
<p>目前已录制了两支视频，分别是<code>Linux_命名管道_聊天室_测试视频</code>和<code>Linux_命名管道_聊天室_测试视频_V2.0</code></p>
</blockquote>
<ul>
<li>点击观看 <strong><a href="https://www.bilibili.com/video/BV1254y197AU/">BiliBili - Linux_命名管道_聊天室_测试视频_V2.0版本</a></strong></li>
<li>修复了V1.0版本退出程序的bug</li>
<li>实现了在某个客户端退出后，服务器向其他用户发送通知的功能</li>
<li>优化了客户端界面</li>
</ul>
<hr />
<ul>
<li>点击观看 <strong><a href="https://www.bilibili.com/video/BV1Pi4y187co/">BiliBili - Linux_命名管道_聊天室_测试视频_V1.0版本</a></strong></li>
<li>实现了群聊功能</li>
<li>实现了以用户名为标识的私聊功能</li>
</ul>
<hr />
              
            </div>
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="../05_Log/" class="btn btn-neutral float-right" title="项目日志">Next <span class="icon icon-circle-arrow-right"></span></a>
      
      
        <a href="../03_Analysis/" class="btn btn-neutral" title="流程分析"><span class="icon icon-circle-arrow-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <!-- Copyright etc -->
    
      <p>Copyleft 2020-2021 ZhangHoujin</p>
    
  </div>

  Built with <a href="http://www.mkdocs.org">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
      
        </div>
      </div>

    </section>

  </div>

  <div class="rst-versions" role="note" style="cursor: pointer">
    <span class="rst-current-version" data-toggle="rst-current-version">
      
      
        <span><a href="../03_Analysis/" style="color: #fcfcfc;">&laquo; Previous</a></span>
      
      
        <span style="margin-left: 15px"><a href="../05_Log/" style="color: #fcfcfc">Next &raquo;</a></span>
      
    </span>
</div>
    <script>var base_url = '..';</script>
    <script src="../js/theme.js" defer></script>
      <script src="../search/main.js" defer></script>

</body>
</html>
